#ifndef AUDIODECODETASK_H
#define AUDIODECODETASK_H

#include <ClientImpl/Receive_handler.h>
#include <Task_Base/Task_Base.h>
#include <libavinclude.h>
#include "rtmp.h"//_sys
#include "log.h"
class RtmpTask: public Task_Base
{
public:
    RtmpTask(Receive_handler*);
    ~RtmpTask();
public:
    virtual int close();
protected:
    virtual int svc();//主动工作线程函数
private:

    RTMP *  (*pRTMP_Alloc)(void);
    void    (*pRTMP_Init)(RTMP *r);
    int     (*pRTMP_SetupURL)(RTMP *r, char *url);
    void    (*pRTMP_Free)(RTMP *r);
    void    (*pRTMP_Close)(RTMP *r);
    void    (*pRTMP_EnableWrite)(RTMP *r);
    void    (*pRTMP_SetBufferMS)(RTMP *r, int size);
    int     (*pRTMP_Connect)(RTMP *r, RTMPPacket *cp);
    int     (*pRTMP_ConnectStream)(RTMP *r, int seekTime);
    int     (*pRTMP_Read)(RTMP *r, char *buf, int size);

    Receive_handler *m_pHandler;
    std::string      strInfoHand;
    void           *pSo_handler;
    FILE* outfile;
    RTMP *rtmp;

    bool  bExit;
    int m_pack_num1;
    int m_pack_num2;
};

#endif // AUDIODECODETASK_H
